package com.xsh.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;

/**
 * @author lixing
 * @date 2021/6/7 13:22
 */
@Controller
@RequestMapping("/test")
public class Test {

    @GetMapping("abc")
    @ResponseBody
    public String test1(String a, String b, HttpServletResponse response) throws Exception {
        System.out.println(a);
        ServletOutputStream outputStream = response.getOutputStream();

        if (a.equals("1")){
           /* try {
                throw new Exception("xxxxxxxx");
            } catch (Exception e) {

            }*/
           outputStream.write("错误！".getBytes());
            System.out.println("abc");
           throw new Exception("aaaa");
        }
        return "bbbbb";
    }
}
